package com.active.fnd.arch.util
{
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.utils.Dictionary;


	/**
	 * GlobalEventDispatcher is to create a global eventDispatcher
	 * @author David Zhang
	 */
	public class GlobalEventDispatcher
	{
		private static var _instance:GlobalEventDispatcher;

		public static function getInstance():GlobalEventDispatcher
		{
			if (_instance == null)
			{
				_instance = new GlobalEventDispatcher(new PrivateClass());
			}
			return _instance;
		}

		public function GlobalEventDispatcher(privateClass:PrivateClass)
		{
			if (privateClass == null)
			{
				throw new Error("GlobalEventDispatcher cannot be instantiated, use getInstance()");
			}
		}

		private var eventDispatcher:EventDispatcher = new EventDispatcher();

		public function dispatchEvent(event:Event):void
		{
			eventDispatcher.dispatchEvent(event);
		}

		public function addEventListener(type:String, listener:Function):void
		{
			eventDispatcher.addEventListener(type, listener);
		}
	}
}

internal class PrivateClass
{
}
